// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  // API 调用都保持和云函数当前所在环境一致
  //env: cloud.DYNAMIC_CURRENT_ENV
  env: 'rowen-1dg3l'
})
const db = cloud.database()
const _ = db.command
// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext =await cloud.getWXContext()
  var isok = false
  try {
    return await db.collection('admin').doc('oMr_G5PFfqcEsZPWQhX5qxQ-AjH8').get().then(res => {
      if (res.data.password == event.psw) {
        isok = true
      } else {
       isok=false
      }
    })
  } catch (e) {
    console.error(e)
  }
}